package dcc.service;

import dcc.model.CountrysidePracticalInfo;
import dcc.persistence.CountrysidePracticalMapper;

public class CountrysidePracticalService extends BaseService {

	private CountrysidePracticalMapper countrysidePracticalMapper;

	public void setCountrysidePracticalMapper(
			CountrysidePracticalMapper countrysidePracticalMapper) {
		this.countrysidePracticalMapper = countrysidePracticalMapper;
	}

	public CountrysidePracticalService() {
		super(CountrysidePracticalService.class);
	}

	public void save(CountrysidePracticalInfo countrysidePracticalInfo) {
		if (countrysidePracticalInfo.getId() == 0) {
			insert(countrysidePracticalInfo);
		} else {
			update(countrysidePracticalInfo);
		}
	}

	private void insert(CountrysidePracticalInfo countrysidePracticalInfo) {
		countrysidePracticalMapper.insert(countrysidePracticalInfo);
	}

	private void update(CountrysidePracticalInfo countrysidePracticalInfo) {
		countrysidePracticalMapper.update(countrysidePracticalInfo);
	}

	public CountrysidePracticalInfo getCountrysidePracticalInfoByBaseId(
			int baseId) {
		return countrysidePracticalMapper
				.getCountrysidePracticalInfoByBaseId(baseId);
	}
}
